<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//session_start();
//$UserID = $_SESSION['ID'];
include_once('Mysql_connect.inc');//启动连接，连接名：$conn

echo '<table>';
echo '<tr>';
echo '<th>course_id</th>';
echo '<th>teacher_name</th>';
echo '<th>subject</th>';
echo '<th>credit_hour</th>';
echo '<th>description</th>';
echo '<th>college</th>';
echo '<th>class_room</th>';
echo '</tr>';
$result = mysqli_query($conn, "SELECT course_id, name, subject, credit_hour, description, college.college, class_room
FROM course ,college ,teacher
WHERE
teacher.teacher_id =  course.teacher_id AND
course.college =  college.id
 ");
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
    echo '<tr>';
    echo '<td>' . $row['course_id'] . '</td>';
    echo '<td>' . $row['name'] . '</td>';
    echo '<td>' . $row['subject'] . '</td>';
    echo '<td>' . $row['credit_hour'] . '</td>';
    echo '<td>' . $row['description'] . '</td>';
    echo '<td>' . $row['college'] . '</td>';
    echo '<td>' . $row['class_room'] . '</td>';
    echo '</tr>';
}
mysqli_free_result($result);
echo '</table>';


include_once('Mysql_unconnect.inc'); //断开连接
?>
